home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Tools / Dev / Meshwriter / MeshWriterTest / modules / circle.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-03  |  2.2 KB  |  70 lines

  1. /*
  2. **      $VER: circle.c 1.00 (20.3.1999)
  3. **
  4. **      Creation date     : 20.3.1999
  5. **
  6. **      Description       :
  7. **         MeshWriter testprogram shape module.
  8. **
  9. **
  10. **      Written by Stephan Bielmann
  11. **
  12. */
  13.  
  14. /*************************** Includes *******************************/
  15.  
  16. #ifndef WITHMWLLIB
  17. #include "//meshlib.h"
  18. #else
  19. #include <meshwriter/meshwriter.h>
  20. #include <pragma/meshwriter_lib.h>
  21. #endif
  22.  
  23. /**************************** Defines *******************************/
  24.  
  25. #define PI            3.14159265359
  26. #define ROTSTEPS      12
  27.  
  28. /*********************** Type definitions ***************************/
  29.  
  30. /********************** Private functions ***************************/
  31.  
  32. /********************** Public functions ****************************/
  33.  
  34. /********************************************************************\
  35. *                                                                    *
  36. * Name         : circle                                              *
  37. *                                                                    *
  38. * Description  : Draws a circle with the help of the rotation        *
  39. *                function.                                           *
  40. *                                                                    *
  41. * Arguments    : mesh    IN  : An initialized mesh handle.           *
  42. *                                                                    *
  43. * Comment      :                                                     *
  44. *                                                                    *
  45. \********************************************************************/
  46. void circle(ULONG mesh) {
  47.   TOCLVertex v1,vr;
  48.   TOCLColor  color;
  49.   ULONG blue;
  50.  
  51.   MWLMeshMaterialAdd(mesh,&blue);
  52.   color.r=0,color.g=0,color.b=255;
  53.   MWLMeshMaterialNameSet(mesh,blue,"Blue");
  54.   MWLMeshMaterialDiffuseColorSet(mesh,blue,&color);
  55.   MWLMeshMaterialShininessSet(mesh,blue,0);
  56.   MWLMeshMaterialTransparencySet(mesh,blue,0);
  57.  
  58.   MWLMeshNameSet(mesh,"Circle");
  59.  
  60.   v1.x=1,v1.y=0,v1.z=0;
  61.   vr.x=0,vr.y=0;
  62.   MWLMeshPolygonAdd(mesh,blue);
  63.   for(vr.z=0;vr.z<2*PI;vr.z+=PI/ROTSTEPS) {
  64.     MWLMeshPolygonVertexAdd(mesh,&v1);
  65.     MWLMeshRotationChange(mesh,&vr,CTMSET);
  66.   }
  67. }
  68.  
  69. /************************* End of file ******************************/
  70.